/*
 *  video_recorder.h
 *  libCV
 *
 *  Created by Gregory Koch on 08/03/11.
 *  Copyright 2011 IFlyBotIV. All rights reserved.
 *
 */

#ifndef VIDEO_RECORDER_H
#define VIDEO_RECORDER_H

#include "libCV.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

#include <libavformat/avformat.h>
#include <libswscale/swscale.h>

#undef exit

#define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */

typedef struct video_record_s
{
	AVFormatContext *oc;
    AVStream *video_st;
	uint8_t *video_outbuf;
	int video_outbuf_size;
	AVFrame *picture;
} video_record_t;

video_record_t *open_video_record(char *filename, cvSize_t size, int frame_rate);

void add_frame2video_record(video_record_t *video_record, image_t img);

void close_video_record(video_record_t *video_record);

#endif
